﻿#region License
/* ---------------------------------------------------------------- *
 *
 * This file is part of the Xcoordination Application Space
 * ("XcoAppSpace") http://www.xcoordination.com
 *
 * Copyright (C) 2009 Xcoordination http://www.xcoordination.com
 *
 * XcoAppSpace is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General
 * Public License as published by the Free Software Foundation.
 *
 * XcoAppSpace is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 * or write to the Free Software Foundation, Inc., 51 Franklin
 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * ---------------------------------------------------------------- */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Ccr.Core;
using XcoAppSpaces.Contracts.Service;
using XcoAppSpaces.Core;

namespace XcoAppSpaces.Contracts.CcrWiring
{
	/// <summary>
	/// Class that contains information about a worker that is acquired during creation an wiring
	/// of the worker.
	/// </summary>
	/// <typeparam name="T">The contract type of the worker.</typeparam>
	public class WorkerInfo<T>
			where T : IPort
	{
		/// <summary>
		/// The worker instance.
		/// </summary>
		public T Instance { get; set; }

		/// <summary>
		/// List of attributes that are assigned to the worker and could be of interest to other services of the space.
		/// </summary>
		public List<XcoServiceAttributeInfo> ServiceAttributes { get; set; }

		/// <summary>
		/// List of attributes of the processors of this worker.
		/// </summary>
		public Dictionary<Type, XcoProcessorAttribute> ProcessorAttributes { get; set; }

		/// <summary>
		/// Creates a new WorkerInfo.
		/// </summary>
		/// <param name="instance">The worker instance.</param>
		/// <param name="serviceAttributes">List of attributes that are assigned to the worker and could be of interest to other services of the space.</param>
		/// <param name="processorAttributes">List of attributes of the processors of this worker.</param>
		public WorkerInfo(T instance, List<XcoServiceAttributeInfo> serviceAttributes, Dictionary<Type, XcoProcessorAttribute> processorAttributes)
		{
			this.Instance = instance;
			this.ServiceAttributes = serviceAttributes;
			this.ProcessorAttributes = processorAttributes;
		}
	}
}
